<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
      html,
      body {
        margin: 0;
        padding: 0;
        background-color: lightpink;
      }
    </style>
  </head>
  <body>
    <script>
      
      var obj = {
        screenHeight: window.screen.height,
        screenWidth: window.screen.width,
        screenAvailWidth: window.screen.availWidth,
        //可用区域高度  去掉底部任务栏如有
        screenAvailHeight: window.screen.availHeight
      };

      function get() {
        obj = {
          screenHeight: window.screen.height,
          screenWidth: window.screen.width,
          screenAvailWidth: window.screen.availWidth,
          screenAvailHeight: window.screen.availHeight
        };
      }

      var objDesc = {
        screenHeight: "屏幕高",
        screenWidth: "屏幕宽",
        screenAvailWidth: "屏幕可用宽度,即去掉任务栏调试",
        screenAvailHeight: "屏幕可用高度,即去掉任务栏调试"
      };

      for (x in obj) {
        console.log(obj[x], x + ":" + objDesc[x]);
      }
    </script>
  </body>
</html>
